import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 用户信息
 */
@Entity('user_info')
export class UserInfoEntity extends BaseEntity {
  @Index({ unique: true })
  @Column({ comment: '登录唯一ID', nullable: true })
  unionid: string;

  @Column({ comment: '头像', nullable: true })
  avatarUrl: string;

  @Column({ comment: '昵称', nullable: true })
  nickName: string;

  @Index({ unique: true })
  @Column({ comment: '手机号', nullable: true })
  phone: string;

  @Column({ comment: '性别', dict: ['未知', '男', '女'], default: 0 })
  gender: number;

  @Column({ comment: '状态', dict: ['禁用', '正常', '已注销'], default: 1 })
  status: number;

  @Column({ comment: '登录方式', dict: ['小程序', '公众号', 'H5'], default: 0 })
  loginType: number;

  @Column({ comment: '密码', nullable: true })
  password: string;

  @Column({ comment: '介绍', type: 'text', nullable: true })
  description: string;

  @Index()
  @Column({ comment: '微信openid' })
  openid: string;

  @Column({ comment: '注册销售', default: 0 })
  registAdminId: number;

  @Column({ comment: '注册渠道', default: 0 })
  registChannelId: number;

  @Column({ comment: '生日', nullable: true })
  birthday: Date;

  @Column({ comment: '门店ID', nullable: true })
  shopId: number;

  @Column({ comment: '添加微信', default: 0 })
  addWechat: number;

  @Column({ comment: '最近预约', default: 0 })
  lastAppointId: number;
  
  // 注册二维码ID
  @Column({ comment: '注册二维码ID', default: 0 })
  qrcodeId: number;

  // 注册达人名称
  @Column({ comment: '注册达人名称', nullable: true })
  darenName: string;

  // 备注
  @Column({ comment: '备注', type: 'text', nullable: true })
  remark: string;
}
